<?php
require_once "../config/app.config.php";
$entity = new EntityBLL();
//$entityInfo = $entity->GetBaseByID("0001-7f000001-49927f70-1000-74c3e88b", true);
//vp(get_class($entityInfo));
//vp($entityInfo);
vp(uuid());
vp(time());
$user = new UserBLL();
$user->AuthenticateUser("tibor.kiray@gmail.com", "12345");
vp($_SESSION);

//$json = $entity->GetRecordsAsJSON("0001-7f000001-49f2f650-dc32-9ca3883c", 0, 15);
$json = $entity->GetColumnModelAsJSON("0001-7f000001-49f2f650-dc32-9ca3883c");
//vp($json);
/*
$db = GetDatabase();

for($i = 0; $i<100; $i++){
	echo $query = "INSERT INTO `domainone_new`.`entblspecificatii` (
				`ID` ,
				`ENSpecName` ,
				`CreatedBy` ,
				`CreatedDate` ,
				`ModifiedBy` ,
				`ModifiedDate` ,
				`OwnerID` ,
				`GroupID` ,
				`Status` ,
				`u` ,
				`g` ,
				`w`
				)
			VALUES (
				'".uuid()."', '".$i."EN_Spec', '0001-7f000001-49dcf112-9aba-b7375504', '1240660374', '0001-7f000001-49dcf112-9aba-b7375504', '1240660374', '0001-7f000001-49dcf112-9aba-b7375504', '0001-7f000001-49dd33f9-81f2-5ad6be60', '1', '7', '7', '7'
				)";
		$db -> Execute($query);
}
*/
$res = $entity->Create("testName", "testLabel", "testPluralLabel", "testTable");
if($res){
	vp("Success");
}else{
	vp("failure");
}
/*
//ALTER TABLE `entblspecificatii` ADD `ENSpecName` VARCHAR( 255 ) NOT NULL AFTER `ID` 
//vp($json);
//unset($_SESSION["SessionUser"]);
//$entity->Create("testName", "testLabel", "testPluralLabel");
//$entitydvo = new EntityDVO();
//$entitydvo = $entity->GetBaseByID("0001-7f000001-498b6d7c-0800-22ed53c4", true);
//vp($entitydvo);
//$entity->Create("NameD", "LabelD", "PluralLabelD", "TableNameD");
//$entity->Create("ENSpecificatii", "ENSpecificatie", "ENSpecificatii", "en_tbl_Specificatii");
/*
$entity->AddField(
					$entitydvo->getID(),
					"TextField",
					"FieldName",
					"sdfsf^%.$^&gfjh",
					"1",
					"1");
*/
//$db = GetDatabase();

/*
$db->BeginTrans();

$ok = $db->Execute("INSERT into arthur (id, titlu, descriere) values (1,2,3)"); 
if ($ok) $ok = $db->Execute("INSERT into arthur (id, titlu, descriere) values (4,5,6)"); 
if ($ok) $ok = $db->Execute("INSERT into arthur (id, titlu, descriere) values (7,8,9)"); 
if ($ok) $db->CommitTrans();

else $db->RollbackTrans();
*/





//$entity = new Entity(1);
//vp($entity->CreateEntityBase("TEST_WITH_TABLE", "TEST_WITH_TABLE", "TESTS_WITH_TABLE"));
//$entityField = new EntityField(0);
//if ($entity->EntityNameIsUnique("Proiecte11s"))
/*
if (Entity::EntityNameIsUnique("Proiecte11s"))
{
    echo "<br />Name can be used";
} else
{
    echo "<br />Name already used";
}
*/
/*
vp($entityField->GenerateCreateColumnQuery("test","TextField"));
if ($entityField->DbFieldIsUnique("lal", "0001-7f000001-49927f70-1000-74c3e88b"))
{
    echo "<br />DbField can be used";
} else
{
    echo "<br />DbField already used";
}
vp($entityField->GenerateCreateColumnQuery("test","TextField"));
echo "<br />".uuid();
*/
?>
<script type="text/javascript" language="JavaScript">
    var temp
</script>
<br />
<a name="test">test</a>